{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li><a href="{php echo web_url('store/category/index')}">商户分类列表</a></li>
	<li {if empty($_GPC['id'])}class="active"{/if}><a href="{php echo web_url('store/category/edit')}">添加商户分类</a></li>
	{if !empty($_GPC['id'])}
	<li class="active"><a href="#">编辑商户分类</a></li>
	{/if}
</ul>
<div class="app-content">
	<div class="app-form">
		<form action="" method="post" class="form-horizontal form form-validate">
			<div class="panel panel-default" id="step1">
				<div class="panel-heading">分类管理</div>
				<div class="panel-body">
					{if !empty($_GPC[parentid])}
						<div class="form-group">
							<label class="col-sm-2 control-label">上级分类</label>
							<div class="col-sm-9">
								<input type="text" name="ccategory[parentid]"  autocomplete="off" class="form-control" value="{$_GPC[parentid]}">
							</div>
						</div>
					{/if}
					<div class="form-group">
						<label class="col-sm-2 control-label">分类名称<span class="must-fill">*</span></label>
						<div class="col-sm-9">
							<input type="text" name="category[name]" maxlength="8" required autocomplete="off" class="form-control" value="{$category['name']}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">分类图片</label>
						<div class="col-sm-9">
							{php echo attachment_select('category[thumb]', $category['thumb'])}
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">分类排序</label>
						<div class="col-sm-9">
							<input type="number" name="category[displayorder]" placeholder="排序号越大排列越靠前" class="form-control" value="{$category['displayorder']}" >
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">外部链接<span class="must-fill"></span></label>
						<div class="col-sm-9">
							<input type="text" name="category[abroad]" placeholder="" class="form-control" value="{$category['abroad']}">
						</div>
					</div>
					{if empty($_GPC[parentid]) && Customized::init('storecate1520') > 0}
					<div class="form-group">
						<label class="col-sm-2 control-label">幻灯片</label>
						<div class="col-sm-9">
							<div id="datas">
								{loop $category['adv'] $kw $adv}
								{php include wl_template('store/advinfo');}
								{/loop}
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label"></label>
						<div class="col-sm-9">
							<a class="btn btn-info btn-add-type" href="javascript:;" onclick="addType();">
								<i class="fa fa-plus" title=""></i>增加一张幻灯片
							</a>
						</div>
					</div>
					{/if}
					<div class="form-group">
						<label class="col-sm-2 control-label">是否开启</label>
						<div class="col-sm-9">
                            <label class="radio-inline">
                                <input type="radio" name='enabled' value='1' {if $category['enabled']==1}checked{/if}>开启
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name='enabled' value='0' {if $category['enabled']==0}checked{/if}>关闭
                            </label>
						</div>
					</div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"></label>
                        <div class="col-sm-9">
                            <input type="submit" name="submit" value="提交" class="btn btn-primary min-width" />
                            <input type="hidden" name="token" value="{$_W['token']}" />
                        </div>
                    </div>
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	var kw = 100;
	function addType() {
		$(".btn-add-type").button("loading");
		$.ajax({
			url: "{php echo web_url('store/category/advinfo')}&kw="+kw,
			cache: false
		}).done(function (html) {
			$(".btn-add-type").button("reset");
			$("#datas").append(html);
		});
		kw++;
	}

	function removes(asd){
		$(asd).closest('.removedav').remove();
	}
</script>
{php include wl_template('common/footer');}